#include "label.h"
#include <QMouseEvent>
#include <QWheelEvent>
#include <QDebug>

Label::Label(QWidget* parent): QLabel(parent)
{
    // setMouseTracking(true);
}


void Label::mouseMoveEvent(QMouseEvent *event)
{
    qDebug() << "[" << event->x() << "," << event->y() << "]";
}

void Label::mousePressEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton) {
        qDebug() << "按下左键";
    } else if (event->button() == Qt::RightButton) {
        qDebug() << "按下右键";
    }
}


void Label::mouseReleaseEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton) {
        qDebug() << "释放左键";
    } else if (event->button() == Qt::RightButton) {
        qDebug() << "释放右键";
    }
}


void Label::mouseDoubleClickEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton) {
        qDebug() << "双击左键";
    } else if (event->button() == Qt::RightButton) {
        qDebug() << "双击右键";
    }
}

void Label::mousewheelEvent(QWheelEvent *event)
{
    qDebug() << event->delta();
}

